package cn.thoughtworks.school.usercenter.repositories;

import cn.thoughtworks.school.usercenter.entities.SocialAccount;
import cn.thoughtworks.school.usercenter.entities.User;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


public interface SocialAccountRepository extends JpaRepository<SocialAccount, Long> {
    @Transactional
    @Modifying
    @Query(value = "delete from socialAccount where username = :username", nativeQuery = true)
    void deleteSocialAccountByUsername(@Param("username") String username);

    @Query(value = "select *  from socialAccount where username = :username", nativeQuery = true)
    List<SocialAccount> findSocialAccountByUsername(@Param("username") String username);


    List<SocialAccount> findByUsername(String username);
}
